package com.jiang.utils;

/**
 * Created by dllo on 18/3/10.
 */
public class AjaxResult {
    private Integer code;
    private String msg;
    private Object data;

    @Override
    public String toString() {
        return "AjaxResult{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public AjaxResult(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public AjaxResult() {
    }

    public static AjaxResult getOk(Object object) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setCode(1);
        ajaxResult.setMsg("成功");
        ajaxResult.setData(object);
        return ajaxResult;
    }

    public static AjaxResult getNo(Object object) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setCode(2);
        ajaxResult.setMsg("失败");
        ajaxResult.setData(object);
        return ajaxResult;
    }
}
